<?php
require_once 'config.php';
session_start();

$conn = getDBConnection();
$result = $conn->query("SELECT * FROM tracking_history ORDER BY id DESC LIMIT 50");

echo '<table border="1" cellpadding="5" style="border-collapse:collapse;">';
echo '<tr>';
for ($i = 0; $i < $result->field_count; $i++) {
    $field = $result->fetch_field_direct($i);
    echo '<th>' . htmlspecialchars($field->name) . '</th>';
}
echo '</tr>';
while ($row = $result->fetch_assoc()) {
    echo '<tr>';
    foreach ($row as $v) {
        echo '<td>' . htmlspecialchars($v) . '</td>';
    }
    echo '</tr>';
}
echo '</table>';

$conn->close(); 